using System;
using System.ComponentModel;
using System.Transactions;

using SIS.ENT;
using SIS.DAL;


/// <summary>
/// The TeacherDesignationTableManager class is responsible for managing BO.TeacherDesignationTable objects in the system.
/// </summary>
[DataObjectAttribute()]
public class TeacherDesignationTableManager
{

    #region "Public Methods"

    /// <summary>
    /// Gets a list with all TeacherDesignationTable objects in the database.
    /// </summary>
    /// <returns>A list with all TeacherDesignationTable from the database when the database contains any, or null otherwise.</returns>
    [DataObjectMethod(DataObjectMethodType.Select, true)]
    public static TeacherDesignationTableList GetList()
    {
        return TeacherDesignationTableDB.GetList();
    }

    [DataObjectMethod(DataObjectMethodType.Select, true)]
    public static TeacherDesignationTableList GetList(int UserAccountKey)
    {
        return TeacherDesignationTableDB.GetList(UserAccountKey);
    }

    /// <summary>
    /// Gets a single TeacherDesignationTable from the database without its data.
    /// </summary>
    /// <param name="teacherDesignationKey">The TeacherDesignationKey of the TeacherDesignationTable in the database.</param>
    /// <returns>A TeacherDesignationTable object when the TeacherDesignationKey exists in the database, or <see langword="null"/> otherwise.</returns>
    [DataObjectMethod(DataObjectMethodType.Select, false)]
    public static TeacherDesignationTable GetItem(int teacherDesignationKey)
    {
        return GetItem(teacherDesignationKey, false);
    }

    /// <summary>
    /// Gets a single TeacherDesignationTable from the database.
    /// </summary>
    /// <param name="teacherDesignationKey">The TeacherDesignationKey of the TeacherDesignationTable in the database.</param>
    /// <param name="getTeacherDesignationTableRecords">Determines whether to load all associated TeacherDesignationTable records as well.</param>
    /// <returns>
    /// A TeacherDesignationTable object when the TeacherDesignationKey exists in the database, or <see langword="null"/> otherwise.
    /// </returns>
    [DataObjectMethod(DataObjectMethodType.Select, false)]
    public static TeacherDesignationTable GetItem(int teacherDesignationKey, bool getTeacherDesignationTableRecords)
    {
        TeacherDesignationTable myTeacherDesignationTable = TeacherDesignationTableDB.GetItem(teacherDesignationKey);
        return myTeacherDesignationTable;
    }

    public static TeacherDesignationTable GetActiveDesignationItem(int UserAccountKey)
    {
        TeacherDesignationTable myTeacherDesignationTable = TeacherDesignationTableDB.GetActiveItem(UserAccountKey);
        return myTeacherDesignationTable;
    }

    /// <summary>
    /// Saves a TeacherDesignationTable in the database.
    /// </summary>
    /// <param name="myTeacherDesignationTable">The TeacherDesignationTable instance to save.</param>
    /// <returns>The new TeacherDesignationKey if the TeacherDesignationTable is new in the database or the existing TeacherDesignationKey when an item was updated.</returns>
    [DataObjectMethod(DataObjectMethodType.Update, true)]
    public static int Save(TeacherDesignationTable myTeacherDesignationTable)
    {
        using (TransactionScope myTransactionScope = new TransactionScope())
        {
            int teacherDesignationTableTeacherDesignationKey = TeacherDesignationTableDB.Save(myTeacherDesignationTable);

            //  Assign the TeacherDesignationTable its new (or existing TeacherDesignationKey).
            myTeacherDesignationTable.TeacherDesignationKey = teacherDesignationTableTeacherDesignationKey;

            myTransactionScope.Complete();

            return teacherDesignationTableTeacherDesignationKey;
        }
    }

    /// <summary>
    /// Deletes a TeacherDesignationTable from the database.
    /// </summary>
    /// <param name="myTeacherDesignationTable">The TeacherDesignationTable instance to delete.</param>
    /// <returns>Returns true when the object was deleted successfully, or false otherwise.</returns>
    [DataObjectMethod(DataObjectMethodType.Delete, true)]
    public static bool Delete(TeacherDesignationTable myTeacherDesignationTable)
    {
        return TeacherDesignationTableDB.Delete(myTeacherDesignationTable.TeacherDesignationKey);
    }

    [DataObjectMethod(DataObjectMethodType.Delete, true)]
    public static bool Delete(int TeacherDesignationKey)
    {
        return TeacherDesignationTableDB.Delete(TeacherDesignationKey);
    }

    #endregion

}

